$(function(){
    $("img[data-url]").lazyload();

    $(".share").click(function(){
        $(".fix_bg,.share_info").show();
    });

    if($(".share_info").length>0){
        $(".fix_bg").on("click",function(){
            $(".fix_bg,.share_info").hide();
        });
    }

    var back = getParameterByName("up"),
        re = getParameterByName("re"),
        ca = getParameterByName("ca");

    if(back!==null){
        $.cookie("back",back);
    }

    if(re!==null){
        $.cookie("re",re);
    }

    if(ca!==null){
        $.cookie("ca",ca);
    }
    $("#back,#re,#ca").click(function(){
        var obj = $(this).attr("id"),
            cook = $.cookie(obj);
        if(cook===undefined){
            cook = "index";
            $.cookie(obj,cook);
        }
        window.location.href = cook + ".html";
    });
});

function getParameterByName(name) {
    var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}